﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true"
    CodeFile="AddBranch.aspx.cs" Inherits="Pages_Admin_ManageBranches_AddBranch" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<script language="JavaScript">
function onlyNumbers(evt)
{
	var e = event || evt; // for trans-browser compatibility
	var charCode = e.which || e.keyCode;

	if (charCode > 31 && (charCode < 48 || charCode > 57))
		return false;

	return true;

}
</script>
    <table width="100%">
        <tr>
            <td class="header">
                Add Branch
            </td>
        </tr>
    </table>
    <br />
    <div>
        <form id="AddBranchForm">
        <table class="table01">
            <tr>
                <td width="20%">
                    <b>
                        <asp:Label ID="lblPinCode" runat="server" Text="Pincode"></asp:Label></b>
                </td>
                <td width="40%">
                    <asp:TextBox ID="txtPincode" runat="server" Width="200" ValidationGroup="AddBranch"  onkeypress="return onlyNumbers();"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="valPinCode" runat="server" ErrorMessage="Please pincode of branch"
                        ControlToValidate="txtPincode" ValidationGroup="AddBranch">*</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionPincode" runat="server" ErrorMessage="Pincode is not valid"
                        ControlToValidate="txtPincode" ValidationGroup="AddBranch" ValidationExpression="\d{6}">*</asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td width="20%">
                    <b>
                        <asp:Label ID="lblBranchName" runat="server" Text="Branch's Name"></asp:Label></b>
                </td>
                <td width="40%">
                    <asp:TextBox ID="txtBranchName" runat="server" Width="200" ValidationGroup="AddBranch"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="valBranchName" runat="server" ErrorMessage="Please enter name of branch"
                        ValidationGroup="AddBranch" ControlToValidate="txtBranchName">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td width="20%">
                    <b>
                        <asp:Label ID="lblBranchAddress" runat="server" Text="Branch's Address"></asp:Label></b>
                </td>
                <td width="40%">
                    <asp:TextBox ID="txtBranchAddress" runat="server" Width="200" TextMode="MultiLine"
                        Height="50" ValidationGroup="AddBranch"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="valBranchAddress" runat="server" ErrorMessage="Please enter address of branch"
                        ValidationGroup="AddBranch" ControlToValidate="txtBranchAddress">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td width="20%">
                    <b>Branch's Mobile Phone</b>
                </td>
                <td width="40%">
                    <asp:TextBox ID="txtBranchPhone" runat="server" Width="200" ValidationGroup="AddBranch"  onkeypress="return onlyNumbers();"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="valBranchPhone" runat="server" ErrorMessage="Please enter branch's phone number"
                        ValidationGroup="AddBranch" ControlToValidate="txtBranchPhone">*</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionMobilePhone" runat="server"
                        ControlToValidate="txtBranchPhone" ErrorMessage="Phone number must be between 9-20 digits"
                        Text="*" ValidationGroup="AddBranch" ValidationExpression="\d{9,20}"></asp:RegularExpressionValidator>
                    <br />
                    <asp:Label ID="lblPhoneNumberInstruction" runat="server" Text="Ex: 08438487771"></asp:Label>
                    
                </td>
            </tr>
            <tr>
                <td width="20%">
                    <b>Branch's Fax</b>
                </td>
                <td width="40%">
                    <asp:TextBox ID="txtFax" runat="server" Width="200" ValidationGroup="AddBranch"  onkeypress="return onlyNumbers();"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="valFax" runat="server" ErrorMessage="Please enter branch's fax number"
                        ValidationGroup="AddBranch" ControlToValidate="txtFax">*</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionFax" runat="server" ControlToValidate="txtFax"
                        ErrorMessage="Fax number must be between 9-20 digits" Text="*" ValidationGroup="AddBranch"
                        ValidationExpression="\d{9,20}"></asp:RegularExpressionValidator>
                    <br />
                    <asp:Label ID="lblFaxNumberInstruction" runat="server" Text="Ex:9990123456"></asp:Label>
                </td>
            </tr>
            <tr>
                <td width="20%">
                    <b>City Name</b>
                </td>
                <td width="40%">
                    <asp:DropDownList ID="ddlCityName" runat="server" DataSourceID="SqlDataSourceCity"
                        DataTextField="CityName" DataValueField="CityID" ValidationGroup="AddBranch">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSourceCity" runat="server" ConnectionString="<%$ ConnectionStrings:TarsConnection %>"
                        SelectCommand="SELECT [CityID], [CityName] FROM [Cities]"></asp:SqlDataSource>
                    <br />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:Button ID="btnReset" runat="server" Text="Reset" CausesValidation="false" 
                        onclick="btnReset_Click" />
                    <asp:Button ID="btnSubmit" runat="server" Text="Submit" 
                        ValidationGroup="AddBranch" onclick="btnSubmit_Click" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="AddBranch" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:Label ID="lblMessage" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                </td>
            </tr>
        </table>
        </form>
    </div>
</asp:Content>
